home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / blt2_212.zip / bullet_2.h < prev    next >
C/C++ Source or Header  |  1996-10-16  |  32KB  |  750 lines

  1.  
  2. /* BULLET_2.H    16-Oct-96-chh
  3.  *
  4.  *  Bullet header for 32-bit C/C++ (DOSX32, OS/2, and Win32s/Win32)
  5.  *  Bullet call numbers, parameter packs, and error number equates
  6.  *
  7.  *  Requires PLATFORM defined and set to ON_DOSX32 (3), ON_OS2 (4),
  8.  *  or ON_WIN32 (5) before getting here.  For example:
  9.  *    #define PLATFORM ON_DOSX32  (ON_DOSX32 defined as 3)
  10.  *
  11.  */
  12.  
  13. #ifndef __BULLET_H
  14. #define __BULLET_H
  15.  
  16. /*
  17.  * The #pragma pack(1)/#pragma pack() is no longer required since all
  18.  * structure members in this header will align properly -- all are
  19.  * 32-bit size except for the structure "FieldDescType", but fieldDA
  20.  * member (a LONG) is at a 32-bit alignment already (at byte offset +12).
  21.  * The altFieldLength member, same structure, is also already at
  22.  * proper alignment for a 16-bit value (at byte offset +18).  If, for
  23.  * some reason, your compiler aligns the members differently, then you
  24.  * must use the appropriate compiler pragma to prevent this -- the
  25.  * FieldDescType size is 32 bytes exactly.  It is not likely that any
  26.  * conforming compiler will alter this structure, but, now you know what
  27.  * to do if it does.
  28.  *
  29.  * #pragma pack(1)
  30.  *
  31.  * NOTE: In your program source code, when you layout your record buffer
  32.  * structure, you must use the #pragma pack(1)/#pragma pack() directives
  33.  * around it since it will be, most likely, modified.  The reason is that
  34.  * this structure MUST start with the implicit TAG field (a BYTE), and so,
  35.  * unless you use only BYTE/CHAR members in your structure (Bullet can use
  36.  * binary field values), or take special care to align the record layout
  37.  * so no padding is performed by the compiler, then you will need to use
  38.  * the pack(1) pragma.
  39.  *
  40.  * #pragma pack()
  41.  */
  42.  
  43. /* Re: Bullet/X for DOSX32:
  44.  * (refer to ccdosfn.c for more)
  45.  * Bullet ccdosfn.c provides no OS call support to determine the
  46.  * system country code and code page ID.  This can be coded in
  47.  * ccdosfn.c, but it is quite compiler- and extender-dependent.
  48.  * The current state is to supply a collate sequence table for
  49.  * country code=1 and code page=437 (the table is statically coded).
  50.  * For other sort tables, modify as required.  If support for this
  51.  * at the system level is made available at run-time, you may
  52.  * want to change the following to 0, for both CTRYCODE and CODEPAGE.
  53.  * Until this is so coded, you cannot use 0 here (as with the Win32
  54.  * and OS/2 versions), else error EXB_216501 (8251) is the result.
  55.  * This table is added to each index file (if NLS or a user sort).
  56.  */
  57.  
  58. #ifndef PLATFORM
  59.  #error No PLATFORM specified
  60.  #error ---------------------
  61. #endif
  62.  
  63. #ifndef ON_DOSX32
  64.  ON_DOSX32 3
  65.  ON_OS2    4
  66.  ON_WIN32  5
  67. #endif
  68.  
  69. #if PLATFORM == ON_DOSX32
  70.  #define CTRYCODE 1     /* 0 signifies default country code (at index create) */
  71.  #define CODEPAGE 437   /* 0 signifies default code page (at index create) */
  72.                         /* but DOS extender may not support OS call to get info */
  73.                         /* see ccdosfn.c for making changes for DOSX32 platform */
  74.  #define RELOCK_AVAIL 0 /* relock not supported */
  75.  
  76.  #define VOID void      /* these are already defined if Win32 or OS/2, but not DOS */
  77.  #define SHORT short
  78.  #define LONG long
  79.  #define CHAR char
  80.  
  81.  typedef unsigned char BYTE;
  82.  typedef unsigned short USHORT;
  83.  typedef unsigned long ULONG;
  84.  typedef unsigned char *PSZ;
  85.  typedef VOID *PVOID;
  86.  
  87.  #define APIENTRY __cdecl
  88.  
  89. #elif PLATFORM == ON_OS2
  90.  #define CTRYCODE 0
  91.  #define CODEPAGE 0
  92.  #define RELOCK_AVAIL 1    /* relock is supported */
  93.  
  94.  /* above types are assumed defined in os2def.h */
  95.  
  96. #elif PLATFORM == ON_WIN32
  97.  #define CTRYCODE 0
  98.  #define CODEPAGE 0     /* may be ANSI or OEM code page value, depending on USE*CHARSET flag */
  99.  #define RELOCK_AVAIL 0 /* relock not supported */
  100.  
  101.  /* above types are assume defined in windef.h and winnt.h */
  102.  
  103. #else
  104.  #error No PLATFORM specified
  105.  #error ---------------------
  106.  
  107. #endif
  108.  
  109. #ifndef __BLT_DYNA    // define this if using run-time loading of BULLET*.DLL
  110.                       // via LoadLibrary(Win32) or DosLoadModule(OS/2)
  111.  #ifdef __cplusplus
  112.   extern "C" LONG APIENTRY BULLET(PVOID datapack);
  113.  #else
  114.   extern LONG APIENTRY BULLET(PVOID datapack);
  115.  #endif
  116.  
  117. #else
  118.  
  119.   LONG (* APIENTRY BULLET)(PVOID datapack);
  120.  
  121. #endif
  122.  
  123.  
  124.  
  125. /* The following on mutex-semaphore protection does not apply to Bullet/X */
  126. /* unless the semaphore routines (in ccdosfn.c) are coded to do something */
  127.  
  128. /* All Bullet routines are mutex-semaphore protected except the following:
  129.  *
  130.  * MEMORY_XB            STAT_HANDLE_XB          GET_ERROR_CLASS_XB
  131.  * QUERY_SYSVARS_XB     QUERY_VECTORS_XB        CHECK_REMOTE_XB
  132.  * STAT_DATA_XB         STAT_INDEX_XB
  133.  *
  134.  * This means that any thread can call the above routines at any time.  All
  135.  * other calls in the current process block until the previous thread exits 
  136.  * BULLET.  The default mutex wait is 0 milliseconds, and can be set via 
  137.  * SET_SYSVARS_XB using the MUTEX_SEM_TIMEOUT index.  In the case of
  138.  * STAT_DATA_XB and STAT_INDEX_XB, these should be used only when there
  139.  * is no chance that another thread may close that file handle while the
  140.  * routine is working.
  141.  *
  142.  */
  143.  
  144.  
  145.  
  146. /* ************************************************************************
  147.  *
  148.  * xxx.func call numbers
  149.  *
  150.  * ************************************************************************/
  151.  
  152. #define GEN_ERR_XB              0
  153. #define INIT_XB                 1  /* system */
  154. #define EXIT_XB                 2
  155. #define MEMORY_XB               4
  156. #define BACKUP_FILE_XB          6
  157. #define STAT_HANDLE_XB          7
  158. #define GET_ERROR_CLASS_XB      8
  159.  
  160. #define QUERY_SYSVARS_XB        10 /* advanced system */
  161. #define SET_SYSVARS_XB          11
  162. #define SET_DVMON_XB            12 /* reserved */
  163. #define QUERY_VECTORS_XB        13
  164. #define SET_VECTORS_XB          14
  165.  
  166. #define CREATE_DATA_XB          20 /* data control mid-level */
  167. #define OPEN_DATA_XB            21
  168. #define CLOSE_DATA_XB           22
  169. #define STAT_DATA_XB            23
  170. #define READ_DATA_HEADER_XB     24
  171. #define FLUSH_DATA_HEADER_XB    25
  172. #define COPY_DATA_HEADER_XB     26
  173. #define ZAP_DATA_HEADER_XB      27
  174.  
  175. #define CREATE_INDEX_XB         30 /* key control mid-level */
  176. #define OPEN_INDEX_XB           31
  177. #define CLOSE_INDEX_XB          32
  178. #define STAT_INDEX_XB           33
  179. #define READ_INDEX_HEADER_XB    34
  180. #define FLUSH_INDEX_HEADER_XB   35
  181. #define COPY_INDEX_HEADER_XB    36
  182. #define ZAP_INDEX_HEADER_XB     37
  183.  
  184. #define GET_DESCRIPTOR_XB       40 /* data access mid-level */
  185. #define GET_RECORD_XB           41
  186. #define ADD_RECORD_XB           42
  187. #define UPDATE_RECORD_XB        43
  188. #define DELETE_RECORD_XB        44
  189. #define UNDELETE_RECORD_XB      45
  190. #define DEBUMP_RECORD_XB        46
  191. #define PACK_RECORDS_XB         47
  192.  
  193. #define GET_MEMO_SIZE_XB        50 /* memo access mid-level */
  194. #define GET_MEMO_XB             51
  195. #define ADD_MEMO_XB             52
  196. #define UPDATE_MEMO_XB          53
  197. #define DELETE_MEMO_XB          54
  198. #define MEMO_BYPASS_XB          59 /* see below for bypass ordinals */
  199.  
  200. #define BYPASS_CREATE_MEMO       1 /* The bypass routines are automatically */
  201. #define BYPASS_OPEN_MEMO         2 /* performed by BULLET but can be done */
  202. #define BYPASS_CLOSE_MEMO        3 /* manually, if needed - these numbers are */
  203. #define BYPASS_READ_MEMO_HEADER  4 /* put in MDP.memoBypass, with MDP.func */
  204. #define BYPASS_FLUSH_MEMO_HEADER 5 /* set to MEMO_BYPASS_XB */
  205.  
  206. #define FIRST_KEY_XB            60 /* key access mid-level */
  207. #define EQUAL_KEY_XB            61
  208. #define NEXT_KEY_XB             62
  209. #define PREV_KEY_XB             63
  210. #define LAST_KEY_XB             64
  211. #define STORE_KEY_XB            65
  212. #define DELETE_KEY_XB           66
  213. #define BUILD_KEY_XB            67
  214. #define GET_CURRENT_KEY_XB      68
  215. #define GET_KEY_FOR_RECORD_XB   69
  216.  
  217. #define GET_FIRST_XB            70 /* key and data access high-level */
  218. #define GET_EQUAL_XB            71
  219. #define GET_NEXT_XB             72
  220. #define GET_PREV_XB             73
  221. #define GET_LAST_XB             74
  222. #define INSERT_XB               75
  223. #define UPDATE_XB               76
  224. #define REINDEX_XB              77
  225.  
  226. #define LOCK_XB                 80 /* network control */
  227. #define UNLOCK_XB               81
  228. #define LOCK_INDEX_XB           82
  229. #define UNLOCK_INDEX_XB         83
  230. #define LOCK_DATA_XB            84
  231. #define UNLOCK_DATA_XB          85
  232. #define CHECK_REMOTE_XB         86
  233. #define RELOCK_XB               87
  234. #define RELOCK_INDEX_XB         88
  235. #define RELOCK_DATA_XB          89
  236.  
  237. #define DELETE_FILE_DOS         90 /* DOS file I/O low-level */
  238. #define RENAME_FILE_DOS         91
  239. #define CREATE_FILE_DOS         92
  240. #define OPEN_FILE_DOS           93
  241. #define SEEK_FILE_DOS           94
  242. #define READ_FILE_DOS           95
  243. #define WRITE_FILE_DOS          96
  244. #define CLOSE_FILE_DOS          97
  245. #define ACCESS_FILE_DOS         98
  246. #define EXPAND_FILE_DOS         99
  247. #define MAKE_DIR_DOS            100
  248. #define COMMIT_FILE_DOS         101
  249.  
  250. /* ************************************************************************
  251.  *
  252.  * operating system file I/O equates
  253.  *
  254.  * ************************************************************************/
  255.  
  256. #define READONLY        0x00000000 /* std file access mode */
  257. #define WRITEONLY       0x00000001 /* no underscore used for std equates */
  258. #define READWRITE       0x00000002
  259.  
  260. #define DENYREADWRITE   0x00000010 /* std file share mode, cannot be 0 */
  261. #define DENYWRITE       0x00000020
  262. #define DENYREAD        0x00000030
  263. #define DENYNONE        0x00000040
  264. #define NOINHERIT       0x00000080
  265.  
  266. #define NO_LOCALITY     0x00000000 /* optional cache modes */
  267. #define SEQ_LOCALITY    0x00010000
  268. #define RND_LOCALITY    0x00020000
  269. #define MIX_LOCALITY    0x00030000
  270. #define SKIP_CACHE      0x00100000 /* not inherited by child process */
  271. #define WRITE_THROUGH   0x00400000 /* not inherited by child process */
  272.  
  273.  
  274. #define LOCK_SHARED      1         /* a read-only lock, OS/2 and NT only */
  275. #define LOCK_EXCLUSIVE   0         /* default */
  276.  
  277. /* ************************************************************************
  278.  *
  279.  * .sortFunction IDs, Query/SetSysVars|Vectors item IDs
  280.  *
  281.  * ************************************************************************/
  282.  
  283. // SORT_SET flag:  USE_*_CHARSET defaults to OEM character set, and is used
  284. // (OEM or ANSI) if the .sortFunction is NLS or a custom sort-compare.
  285.  
  286. #define USE_OEM_CHARSET  (0 << 17) /* for DOSX32, OS/2, and Windows */
  287. #define USE_ANSI_CHARSET (1 << 17) /* for Windows (.sortFunction flag) */
  288.  
  289. #define DUPS_ALLOWED (1 << 16) /* allow duplicate keys (.sortFunction flag) */
  290.  
  291. /* All Bullet system vars set to default values at INIT_XB */
  292. /* Sorts 1-19 also used as CIP.sortFunction (can be OR'ed with DUPS_ALLOWED) */
  293. /* Intrinsic sorts (1-6) are read-only (R-O) */
  294.  
  295. #define ASCII_SORT 1    /* sort by: ASCII value (R-O) */
  296. #define NLS_SORT   2    /* NLS (R-O) */
  297. #define S16_SORT   3    /* 16-bit signed integer (R-O) */
  298. #define U16_SORT   4    /* 16-bit unsigned integer (R-O) */
  299. #define S32_SORT   5    /* 32-bit signed integer (R-O) */
  300. #define U32_SORT   6    /* 32-bit unsigned integer (R-O) */
  301.  
  302. /* sorts 7 to 9 are reserved */
  303. /* Custom sort-compare functions are from 10 to 19 */
  304.  
  305. #define BUILD_KEY_FUNC  20      /* key build function ptr */
  306. #define PARSER_FUNC     21      /* key expression parser function ptr */
  307.  
  308. #define MUTEX_SEM_HANDLE     29 /* handle of Bullet's mutex semaphore (R-O) */
  309. #define LOCK_TIMEOUT         30 /* lock-wait timeout (default=0, no wait)*/
  310. #define MUTEX_SEM_TIMEOUT    31 /* mutex semaphore-wait timeout (def=0,none) */
  311. #define PACK_BUFFER_SIZE     32 /* pack buffer size (def=0, min autosize) */
  312. #define REINDEX_BUFFER_SIZE  33 /* reindex buffer size (def=0, min autosize) */
  313. #define REINDEX_PACK_PCT     34 /* reindex node pack % (default=100, max) */
  314. #define TMP_PATH_PTR         35 /* temporary file path ptr (default=NULL) */
  315. #define REINDEX_SKIP_TAG     36 /* index skip tag select (default=0, none) */
  316. #define COMMIT_AT_EACH       37 /* commit each insert/update in pack (def=0) */
  317. #define MEMO_BLOCKSIZE       38 /* memo block size (default=512 bytes) */
  318. #define MEMO_EXTENSION       39 /* memo filename extension (default='DBT\0') */
  319. #define MAX_DATAFILE_SIZE    40 /* max data size (default=0x7FEFFFFF=2095MB) */
  320. #define MAX_INDEXFILE_SIZE   41 /* max index size (default=0x7FEFFFFF=2095MB)*/
  321. #define ATOMIC_MODE          42 /* bit0=1 atomic next/prev key access (def=0)*/
  322. #define CALLBACK_PTR         43 /* callback at reindex/pack (def=0, none) */
  323.  
  324. /* ************************************************************************
  325.  *
  326.  * Query/SetVectors vector IDs
  327.  *
  328.  * ************************************************************************/
  329.  
  330. #define VECTOR_CLOSE_FILE           2
  331. #define VECTOR_CREATE_DIR           3
  332. #define VECTOR_CREATE_FILE          4
  333. #define VECTOR_CREATE_UNIQUE_FILE   5
  334. #define VECTOR_DELETE_FILE          6
  335. #define VECTOR_LENGTH_FILE          7
  336. #define VECTOR_MOVE_FILE            8
  337. #define VECTOR_OPEN_FILE            9
  338. #define VECTOR_READ_FILE           10
  339. #define VECTOR_SEEK_FILE           11
  340. #define VECTOR_UPDATE_DIR_ENTRY    12
  341. #define VECTOR_WRITE_FILE          13
  342. #define VECTOR_LOCK_FILE           14
  343. #define VECTOR_IS_DRIVE_REMOTE     15
  344. #define VECTOR_IS_FILE_REMOTE      16
  345. #define VECTOR_EXITLIST            17
  346. #define VECTOR_REMOVE_EXITLIST     18
  347. #define VECTOR_FREE                19
  348. #define VECTOR_GET_SORT_TABLE      20
  349. #define VECTOR_GET_COUNTRY_INFO    21
  350. #define VECTOR_GET_ERROR_CLASS     22
  351. #define VECTOR_GET_MEMORY          23
  352. #define VECTOR_GET_TMP_DIR         24
  353. #define VECTOR_GET_VERSION         25
  354. #define VECTOR_MALLOC              26
  355. #define VECTOR_SET_HANDLE_COUNT    27
  356. #define VECTOR_GET_TIME_INFO       28
  357. #define VECTOR_UPPERCASE           29
  358. #define VECTOR_CLOSE_MUTEX_SEM     30
  359. #define VECTOR_CREATE_MUTEX_SEM    31
  360. #define VECTOR_RELEASE_MUTEX_SEM   32
  361. #define VECTOR_REQUEST_MUTEX_SEM   33
  362.  
  363.  
  364. /* ************************************************************************
  365.  *
  366.  * Parameter pack structures, typedefs
  367.  *
  368.  * ************************************************************************/
  369.  
  370. /* AP, CP, CDP, etc., are suggested variable names */
  371.  
  372. typedef struct _ACCESSPACK {
  373. ULONG func;
  374. ULONG stat;
  375. ULONG handle;         /* I, handle of Bullet file to access */
  376. LONG  recNo;          /* IO, record number */
  377. PVOID recPtr;         /* I, programmer's record buffer */
  378. PVOID keyPtr;         /* I, programmer's key buffer */
  379. PVOID nextPtr;        /* I, NULL if not xaction, else next AP in list */
  380. } ACCESSPACK; /* AP */
  381. typedef ACCESSPACK *PACCESSPACK;
  382.  
  383. /* CBP is the structure received by the callback procedure */
  384. /* structure members are filled in by Bullet */
  385.  
  386. typedef struct _CALLBACKPACK {
  387. ULONG sizeIs;         /* structure size (current 16 bytes) */
  388. ULONG callMode;       /* 0=from reindex; 1=from DBF pack */
  389. ULONG handle;         /* file handle */
  390. ULONG data1;          /* for callMode=0/1: progress percent (1-99,0) */
  391. } CALLBACKPACK; /* CBP */
  392. typedef CALLBACKPACK *PCALLBACKPACK;
  393.  
  394. typedef struct _COPYPACK {
  395. ULONG func;
  396. ULONG stat;
  397. ULONG handle;         /* I, handle of Bullet file to copy */
  398. PSZ   filenamePtr;    /* I, filename to use (drv+path must exist if used) */
  399. } COPYPACK; /* CP */
  400. typedef COPYPACK *PCOPYPACK;
  401.  
  402. typedef struct _CREATEDATAPACK {
  403. ULONG func;
  404. ULONG stat;
  405. PSZ   filenamePtr;    /* I, filename to use */
  406. ULONG noFields;       /* I, 1 to 254 */
  407. PVOID fieldListPtr;   /* I, descriptor list, 1 per field */
  408. ULONG fileID;         /* I, 0x03 for standard DBF, 0x8B if memo file also */
  409. } CREATEDATAPACK; /* CDP */
  410. typedef CREATEDATAPACK *PCREATEDATAPACK;
  411.  
  412. typedef struct _CREATEINDEXPACK {
  413. ULONG func;
  414. ULONG stat;
  415. PSZ   filenamePtr;    /* I, filename to use */
  416. PSZ   keyExpPtr;      /* I, e.g., "SUBSTR(LNAME,1,4)+SSN" */
  417. LONG  xbLink;         /* I, opened data file handle this indexes */
  418. ULONG sortFunction;   /* I, 1-9 system, 10-19 custom */
  419. ULONG codePage;       /* I, 0=use process default */
  420. ULONG countryCode;    /* I, 0=use process default */
  421. PVOID collatePtr;     /* I, NULL=use cc/cp else use passed table for sort */
  422. ULONG nodeSize;       /* I, 512, 1024, or 2048 */
  423. } CREATEINDEXPACK; /* CIP */
  424. typedef CREATEINDEXPACK *PCREATEINDEXPACK;
  425.  
  426. typedef struct _FIELDDESCTYPE {
  427. BYTE  fieldName[11];  /* IO, upper A-Z and _; 1-10 chars, 0-filled, 0-term */
  428. BYTE  fieldType;      /* IO, C,D,L,N, or M */
  429. LONG  fieldDA;        /* x, offset within record (run-time storage option) */
  430. BYTE  fieldLen;       /* IO, C=1-255,D=8,L=1,N=1-19,M=10 */
  431. BYTE  fieldDC;        /* IO, fieldType=N then 0-15 else 0 */
  432. USHORT altFieldLength;/* IO, 0 */
  433. BYTE  filler[12];     /* I, 0 */
  434. } FIELDDESCTYPE; /* nested in _DESCRIPTORPACK */
  435. typedef FIELDDESCTYPE *PFIELDDESCTYPE;
  436.  
  437. typedef struct _DESCRIPTORPACK {
  438. ULONG func;
  439. ULONG stat;
  440. ULONG handle;         /* I, handle of DBF file */
  441. ULONG fieldNumber;    /* IO, first field is 1 */
  442. ULONG fieldOffset;    /* O, offset of field within record (tag=offset 0) */
  443. FIELDDESCTYPE FD;     /* IO FD.fieldName only, O for rest of FD */
  444. } DESCRIPTORPACK; /* DP */
  445. typedef DESCRIPTORPACK *PDESCRIPTORPACK;
  446.  
  447. typedef struct _DOSFILEPACK {
  448. ULONG func;
  449. ULONG stat;
  450. PSZ   filenamePtr;    /* I, filename to use */
  451. ULONG handle;         /* IO, handle of open file */
  452. ULONG asMode;         /* I, access-sharing mode */
  453. ULONG bytes;          /* IO, bytes to read, write, length of */
  454. LONG  seekTo;         /* IO, seek to offset, current offset */
  455. ULONG method;         /* I, seek method (0=start of file, 1=current, 2=end) */
  456. PVOID bufferPtr;      /* I, buffer to read into or write from */
  457. ULONG attr;           /* I, attribute to create file with */
  458. PSZ   newNamePtr;     /* I, name to use on rename */
  459. } DOSFILEPACK; /* DFP */
  460. typedef DOSFILEPACK *PDOSFILEPACK;
  461.  
  462. typedef struct _EXITPACK {
  463. ULONG func;
  464. ULONG stat;
  465. } EXITPACK; /* EP */
  466. typedef EXITPACK *PEXITPACK;
  467.  
  468. typedef struct _HANDLEPACK {
  469. ULONG func;
  470. ULONG stat;
  471. ULONG handle;         /* I, handle of Bullet file */
  472. } HANDLEPACK; /* HP */
  473. typedef HANDLEPACK *PHANDLEPACK;
  474.  
  475. typedef struct _INITPACK {
  476. ULONG func;
  477. ULONG stat;
  478. ULONG JFTsize;        /* I, max opened files (20-1024+) */
  479. ULONG versionDOS;     /* O, e.g., 230 for 2.30 */
  480. ULONG versionBullet;  /* O, e.g., 2019 for 2.019 */
  481. ULONG versionOS;      /* O, e.g., 4=OS/2 32-bit */
  482. PVOID exitPtr;        /* O, function pointer to EXIT_XB routine */
  483. } INITPACK; /* IP */
  484. typedef INITPACK *PINITPACK;
  485.  
  486. typedef struct _LOCKPACK {
  487. ULONG func;
  488. ULONG stat;
  489. ULONG handle;         /* I, handle of Bullet file to lock */
  490. ULONG xlMode;         /* I, index lock mode (0=exclusive, 1=shared) */
  491. ULONG dlMode;         /* I, data lock mode (0=exclusive, 1=shared) */
  492. LONG  recStart;       /* I, if data, first record # to lock, or 0 for all */
  493. ULONG recCount;       /* I, if data and recStart!=0, # records to lock */
  494. PVOID nextPtr;        /* I, NULL if not xaction, else next LP in list */
  495. } LOCKPACK; /* LP */
  496. typedef LOCKPACK *PLOCKPACK;
  497.  
  498. typedef struct _MEMODATAPACK {
  499. ULONG func;
  500. ULONG stat;
  501. ULONG dbfHandle;      /* I, handle of DBF file to which this memo file belongs */
  502. ULONG memoBypass;     /* I, memo bypass function to do, if any */
  503. PVOID memoPtr;        /* I, ptr to memo record buffer */
  504. ULONG memoNo;         /* IO, memo record number (aka block number) */
  505. ULONG memoOffset;     /* I, position within record to start read/update */
  506. ULONG memoBytes;      /* IO, number of bytes to read/update */
  507. } MEMODATAPACK; /* MDP */
  508. typedef MEMODATAPACK *PMEMODATAPACK;
  509.  
  510. typedef struct _MEMORYPACK {
  511. ULONG func;
  512. ULONG stat;
  513. ULONG memory;         /* O, not used in OS/2 */
  514. } MEMORYPACK; /* MP */
  515. typedef MEMORYPACK *PMEMORYPACK;
  516.  
  517. typedef struct _OPENPACK {
  518. ULONG func;
  519. ULONG stat;
  520. ULONG handle;         /* O, handle of file opened */
  521. PSZ   filenamePtr;    /* I, Bullet file to open */
  522. ULONG asMode;         /* I, access-sharing-cache mode */
  523. LONG  xbLink;         /* I, if index open, xbLink=handle of its opened DBF */
  524. } OPENPACK; /* OP */
  525. typedef OPENPACK *POPENPACK;
  526.  
  527. typedef struct _QUERYSETPACK {
  528. ULONG func;
  529. ULONG stat;
  530. ULONG item;           /* I, Bullet sysvar item to get/set */
  531. ULONG itemValue;      /* IO, current/new value */
  532. } QUERYSETPACK; /* QSP */
  533. typedef QUERYSETPACK *PQUERYSETPACK;
  534.  
  535. typedef struct _REMOTEPACK {
  536. ULONG func;
  537. ULONG stat;
  538. ULONG handle;         /* I, handle of file, or if 0, use RP.drive */
  539. ULONG drive;          /* I, drive (1=A,2=B,3=C,...0=current) to check */
  540. ULONG isRemote;       /* O, =1 of handle/drive is remote, =0 if local */
  541. ULONG flags;          /* O, 0 */
  542. ULONG isShare;        /* O, 1 */
  543. } REMOTEPACK; /* RP */
  544. typedef REMOTEPACK *PREMOTEPACK;
  545.  
  546. typedef struct _STATDATAPACK {
  547. ULONG func;
  548. ULONG stat;
  549. ULONG handle;         /* I, handle to check */
  550. ULONG fileType;       /* O, bit0=1 data file */
  551. ULONG flags;          /* O, bit0=1 dirty, bit1=1 full-lock, bit2=1 shared */
  552. ULONG progress;       /* O, 0,1-99% pack progress */
  553. PVOID morePtr;        /* O, 0 */
  554. ULONG fields;         /* O, fields per record */
  555. ULONG asMode;         /* O, access-sharing-cache mode */
  556. PSZ   filenamePtr;    /* O, filename used in open */
  557. ULONG fileID;         /* O, first byte of DBF file */
  558. ULONG lastUpdate;     /* O, high word=year,low byte=day, high byte=month */
  559. ULONG records;        /* O, data records (including "deleted") */
  560. ULONG recordLength;   /* O, record length */
  561. ULONG xactionFlag;    /* O, 0 */
  562. ULONG encryptFlag;    /* O, 0 */
  563. PVOID herePtr;        /* O, this file's control address */
  564. ULONG memoHandle;     /* O, handle of open memo file (0 if none) */
  565. ULONG memoBlockSize;  /* O, memo file block size */
  566. ULONG memoFlags;      /* O, bit0=1 dirty */
  567. ULONG memoLastRecord; /* O, last accessed memo record (0 if none) */
  568. ULONG memoLastSize;   /* O, size of last accessed memo record (in bytes, +8) */
  569. ULONG lockCount;      /* O, number of full-locks in force */
  570. } STATDATAPACK; /* SDP */
  571. typedef STATDATAPACK *PSTATDATAPACK;
  572.  
  573. typedef struct _STATHANDLEPACK {
  574. ULONG func;
  575. ULONG stat;
  576. ULONG handle;         /* I, handle to check */
  577. LONG  ID;             /* O, bit0=1 data file, bit0=1 index file */
  578. } STATHANDLEPACK; /* SHP */
  579. typedef STATHANDLEPACK *PSTATHANDLEPACK;
  580.  
  581. typedef struct _STATINDEXPACK {
  582. ULONG func;
  583. ULONG stat;
  584. ULONG handle;         /* I, handle to check */
  585. ULONG fileType;       /* O, bit0=0 index file */
  586. ULONG flags;          /* O, bit0=1 dirty, bit1=1 full-lock, bit2=1 shared */
  587. ULONG progress;       /* O, 0,1-99% reindex progress */
  588. PVOID morePtr;        /* O, 0 */
  589. ULONG xbLink;         /* O, XB file link handle */
  590. ULONG asMode;         /* O, access-sharing-cache mode */
  591. PSZ   filenamePtr;    /* O, pointer to filename used in open */
  592. ULONG fileID;         /* O, "31ch" */
  593. PSZ   keyExpPtr;      /* O, pointer to key expression */
  594. ULONG keys;           /* O, keys in file */
  595. ULONG keyLength;      /* O, key length */
  596. ULONG keyRecNo;       /* O, record number of current key */
  597. PVOID keyPtr;         /* O, ptr to current key value (valid to keyLength) */
  598. PVOID herePtr;        /* O, this file's control address */
  599. ULONG codePage;       /* O, code page at create time */
  600. ULONG countryCode;    /* O, country code at create time */
  601. PVOID CTptr;          /* O, collate table ptr, NULL=no collate table present */
  602. ULONG nodeSize;       /* O, node size */
  603. ULONG sortFunction;   /* O, sort function ID */
  604. ULONG lockCount;      /* O, number of full-locks in force */
  605. } STATINDEXPACK; /* SIP */
  606. typedef STATINDEXPACK *PSTATINDEXPACK;
  607.  
  608. typedef struct _XERRORPACK {
  609. ULONG func;
  610. ULONG stat;           /* I, error to check */
  611. ULONG errClass;       /* O, class of error */
  612. ULONG action;         /* O, action recommended for error */
  613. ULONG location;       /* O, location of error */
  614. } XERRORPACK; /* XEP */
  615. typedef XERRORPACK *PXERRORPACK;
  616.  
  617.  
  618. /* ************************************************************************
  619.  *
  620.  * Error codes
  621.  *
  622.  * ************************************************************************/
  623.  
  624. #define EXB_NOT_ENOUGH_MEMORY   8  /* cannot get memory requested */
  625. #define EXB_INVALID_DRIVE       15 /* not a valid drive letter */
  626. #define EXB_UNEXPECTED_EOF      38 /* unexpect EOF (bytes read != bytes asked) */
  627. #define EXB_DISK_FULL           39 /* disk full on WriteFile */
  628. #define EXB_FILE_EXISTS         80 /* cannot create file since it already exists */
  629. #define EXB_SEM_OWNER_DIED      105 /* in place of Win32 error 80h (mutex) */
  630. #define EXB_TIMEOUT             640 /* in place of Win32 error 102h (mutex) */
  631.  
  632. /* Other operating system errors are as returned by OS itself */
  633.  
  634. /* System/general error codes */
  635.  
  636. #define EXB_OR_WITH_FAULTS      8192 /* 8192+1 to +4, close-type errors */
  637.  
  638.                                      /* ERR_216501/6 are for Bullet/x only */
  639. #define EXB_216501              8251 /* INT21/6501h not supported by DOS extender */
  640.                                      /* (do not use default cc/cp) */
  641. #define EXB_216506              8256 /* INT21/6506h not supported by DOS extender */
  642.                                      /* (provide a custom collate table) */
  643.  
  644. #define EXB_ILLEGAL_CMD         8300 /* function not allowed */
  645. #define EXB_OLD_DOS             8301 /* OS version < MIN_DOS_NEEDED */
  646. #define EXB_NOT_INITIALIZED     8302 /* init not active, must do INIT_XB */
  647. #define EXB_ALREADY_INITIALIZED 8303 /* init already active, must do EXIT_XB */
  648. #define EXB_TOO_MANY_HANDLES    8304 /* more than 1024 opens requested */
  649. #define EXB_SYSTEM_HANDLE       8305 /* Bullet won't use or close handles 0-2 */
  650. #define EXB_FILE_NOT_OPEN       8306 /* file not open (not Bullet handle, including xbLink) */
  651. #define EXB_FILE_IS_DIRTY       8307 /* tried to reload header but current still dirty */
  652. #define EXB_BAD_FILETYPE        8308 /* tried key op on non-key file, data op on non... */
  653. #define EXB_TOO_MANY_PACKS      8309 /* too many INSERT,UPDATE,REINDEX,LOCK_XB packs */
  654. #define EXB_NULL_RECPTR         8310 /* null record pointer passed to Bullet */
  655. #define EXB_NULL_KEYPTR         8311 /* null key pointer passed to Bullet */
  656. #define EXB_NULL_MEMOPTR        8312 /* null memo pointer passed to Bullet */
  657. #define EXB_EXPIRED             8313 /* evaluation time period has expired */
  658. #define EXB_BAD_INDEX           8314 /* Query/SetSysVars index beyond last one */
  659. #define EXB_RO_INDEX            8315 /* SetSysVar index item is read-only */
  660. #define EXB_FILE_BOUNDS         8316 /* file size > 4GB, or > system var sets */
  661. #define EXB_FORCE_ROLLBACK      8397 /* rollback test completed (internal use) */
  662. #define EXB_INVALID_DLL         8398 /* DLL seems to be invalid, 8399 same */
  663.  
  664. /* Multi-access error codes */
  665.  
  666. #define EXB_BAD_LOCK_MODE       8401 /* lock mode (LP) not valid */
  667. #define EXB_NOTHING_TO_RELOCK   8402 /* cannot relock without existing full-lock */
  668. #define EXB_SHARED_LOCK_ON      8403 /* write access needed but lock is shared (flush on backup) */
  669.  
  670. /* Index error codes */
  671.  
  672. #define EXB_KEY_NOT_FOUND       8501 /* exact match of key not found */
  673. #define EXB_KEY_EXISTS          8502 /* key exists already and dups not allowed */
  674. #define EXB_END_OF_FILE         8503 /* already at last index order */
  675. #define EXB_TOP_OF_FILE         8504 /* already at first index order */
  676. #define EXB_EMPTY_FILE          8505 /* nothing to do since no keys */
  677. #define EXB_CANNOT_GET_LAST     8506 /* cannot locate last key */
  678. #define EXB_BAD_INDEX_STACK     8507 /* index file is corrupt */
  679. #define EXB_BAD_INDEX_READ0     8508 /* index file is corrupt */
  680. #define EXB_BAD_INDEX_WRITE0    8509 /* index file is corrupt */
  681.  
  682. #define EXB_OLD_INDEX           8521 /* old index, run through ReindexOld to update */
  683. #define EXB_UNKNOWN_INDEX       8522 /* not a Bullet index file */
  684. #define EXB_KEY_TOO_LONG        8523 /* keylength > 62 (or 64 if unique), or is 0 */
  685.  
  686. #define EXB_PARSER_NULL         8531 /* parser function pointer is NULL */
  687. #define EXB_BUILDER_NULL        8532 /* build key function pointer is NULL */
  688. #define EXB_BAD_SORT_FUNC       8533 /* CIP.sortFunction not valid */
  689. #define EXB_BAD_NODE_SIZE       8534 /* CIP.nodeSize is not 512, 1024, or 2048 */
  690. #define EXB_FILENAME_TOO_LONG   8535 /* CIP.filenamePtr->pathname > max path length */
  691.  
  692. #define EXB_KEYX_NULL           8541 /* expression is effectively NULL */
  693. #define EXB_KEYX_TOO_LONG       8542 /* CIP.keyExpPtr->expression > 159 */
  694. #define EXB_KEYX_SYM_TOO_LONG   8543 /* fieldname/funcname in expression > 10 chars */
  695. #define EXB_KEYX_SYM_UNKNOWN    8544 /* fieldname/funcname in expression unknown */
  696. #define EXB_KEYX_TOO_MANY_SYMS  8545 /* too many symbols/fields used in expression */
  697. #define EXB_KEYX_BAD_SUBSTR     8546 /* invalid SUBSTR() operand in expression */
  698. #define EXB_KEYX_BAD_SUBSTR_SZ  8547 /* SUBSTR() exceeds field's size */
  699. #define EXB_KEYX_BAD_FORM       8548 /* didn't match expected symbol in expression */
  700.  
  701. #define EXB_NO_READS_FOR_RUN    8551 /* unlikely, use different reindex buffer size */
  702. #define EXB_TOO_MANY_RUNS       8552 /* unlikely, too many runs (64K or more runs) */
  703. #define EXB_TOO_MANY_RUNS_FOR_BUFFER 8553 /* unlikely, too many runs for run buffer */
  704. #define EXB_TOO_MANY_DUPLICATES 8554 /* more than 64K "identical" keys */
  705.  
  706. #define EXB_INSERT_RECNO_BAD    8561 /* AP.recNo cannot be > 0 if inserting */
  707. #define EXB_PREV_APPEND_EMPTY   8562 /* no prev append for insert yet AP.recNo==80000000h */
  708. #define EXB_PREV_APPEND_MISMATCH 8563 /* prev append's xbLink does not match this */
  709. #define EXB_INSERT_KBO_FAILED   8564 /* could not back out key at INSERT_XB */
  710. #define EXB_INSERT_DBO_FAILED   8565 /* could not back out data records at INSERT_XB */
  711.  
  712. #define WRN_NOTHING_TO_UPDATE   8571 /* all AP.recNo=0 at UPDATE_XB */
  713. #define EXB_INTERNAL_UPDATE     8572 /* internal error UPDATE_XB, not in hdl/rec# list */
  714.  
  715. #define EXB_FAILED_DATA_RESTORE 8573 /* could not restore original data record (*) */
  716. #define EXB_FAILED_KEY_DELETE   8574 /* could not remove new key (*) */
  717. #define EXB_FAILED_KEY_RESTORE  8575 /* could not restore original key(*) */
  718. /* *original error, which forced a back-out, has been replaced by this error */ 
  719. /* this error is always returned in the first AP.stat (-1 on data, 1 on index) */
  720.  
  721. /* Data error codes */
  722.  
  723. #define EXB_EXT_XBLINK          8601 /* xbLink handle is not internal DBF (is -1) */
  724. #define EXB_FIELDNAME_TOO_LONG  8602 /* fieldname is > 10 characters */
  725. #define EXB_RECORD_TOO_LONG     8603 /* record length is > 64K */
  726. #define EXB_FIELD_NOT_FOUND     8604 /* fieldname not found in descriptor info */
  727. #define EXB_BAD_FIELD_COUNT     8605 /* fields <= 0 or >= MAX_FIELDS (Init,Open) */
  728.                                      /* and also GetDescriptor by field number */
  729. #define EXB_BAD_HEADER          8606 /* bad header (reclen=0, etc., from LocateTo, Flush) */
  730. #define EXB_BUFFER_TOO_SMALL    8607 /* buffer too small (pack buffer < reclen in pack) */
  731. #define EXB_INTERNAL_PACK       8608 /* internal error in PackRecords */
  732. #define EXB_BAD_RECNO           8609 /* record number=0 or > records in data file hdr */
  733.                                      /* or Pack on empty data file */
  734. #define WRN_RECORD_TAGGED       8610 /* record's tag field matches skip tag */
  735.  
  736. /* Memo error codes */
  737.  
  738. #define WRN_CANNOT_OPEN_MEMO    8701 /* DBF says memo file but memo open fails */
  739. #define EXB_MEMO_NOT_OPEN       8702 /* no open memo file for operation */
  740. #define EXB_BAD_BLOCKSIZE       8703 /* memo blocksize must be at least 24 bytes */
  741. #define EXB_MEMO_DELETED        8704 /* memo is deleted */
  742. #define EXB_MEMO_PAST_END       8705 /* memo data requested is past end of record */
  743. #define EXB_BAD_MEMONO          8706 /* memo number is not valid */
  744. #define EXB_MEMO_IN_USE         8707 /* memo add encountered likely corrupt memo file */
  745. #define EXB_BAD_AVAIL_LINK      8708 /* memo avail link cannot be valid (is 0) */
  746. #define EXB_MEMO_ZERO_SIZE      8709 /* memo data has no size */
  747. #define EXB_MEMO_IS_SMALLER     8710 /* memo attempt to shrink but already <= size */
  748.  
  749. #endif /* ifndef __BULLET_H */
  750.